<?php

class EditMovieView extends View {

	protected $actorsList;
	protected $movieName;
	protected $movieId;
	protected $noCopies;
	protected $actorsPlayed;
	protected $error;
	
	function __construct() {
	
	}
	
	function setError($e) {
		$this->error = $e;
	}
	
	function getError() {
		return $this->error;
	}
	
	function getActorsPlayed() {
		return $this->actorsPlayed;
	}
	
	function setActorsPlayed($m) {
		$this->actorsPlayed = $m;
	}
	
	function display() {
		echo '<div style="width:90%">';
		echo '<h3>Update number of copies for movie '.$this->movieName.'</h3>';
		if (isset($this->error)) {
			echo $this->error;
		}
		echo '<form method="POST" action="index.php?page=store_manager&view=editMovie">';
		echo '<table border="0">';
		echo '<input type="hidden" name="movieId" value="'.$this->movieId.'" />';
		echo '<input type="hidden" name="action" value="save" />';
		echo '<tr><td>Copies:</td><td><input type="text" name="noCopies" value="'.$this->noCopies.'" /></td><td><input type="submit" value="submit" class="btn btn-default" /></td></tr>';
		
		echo '</table>';
		echo '</form>';
		
		echo '<br />';
		echo '<hr />';
		echo '<br />';
		if ($this->actorsPlayed) {
			echo '<h3>Actors Played</h3>';
			echo '<table class="table table-striped">';
			echo '<thead><th>id</th><th>Name</th><th>Surname</th><th>isMajor</th></thead>';
			foreach ($this->actorsPlayed as $actor) {
				echo '<tr><td>'.$actor->getId().'</td>
						<td>'.$actor->getFirstName().'</td>
						<td>'.$actor->getLastName().'</td>
						<td>'.$actor->getIsMajor().'</td>
						</tr>';
			}
			echo '</table>';
		}
		echo '</div>';
		
	}
	
	function getActorsList() {
		return $this->directorsList;
	}
	
	function setActorsList($d) {
		$this->directorsList = $d;
	}
	
	function getMovieName() {
		return $this->movieName;
	}
	
	function setMovieName($m) {
		$this->movieName = $m;
	}
	
	function getMovieId() {
		return $this->movieId;
	}
	
	function setMovieId($m) {
		$this->movieId = $m;
	}
	
	function getNoCopies() {
		return $this->noCopies;
	}
	
	function setNoCopies($m) {
		$this->noCopies = $m;
	}

}

?>